<template>
     <!DOCTYPE html>
<html>
<head>
  <title>微信聊天界面</title>
  <link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body>
  <div class="chat-container">
    <div class="chat">
        <div v-for="(item,index) in message" :key="index">
            <div :class="[item.from == MId?'chat-list-right':'chat-list-left'] ">
                <img :src="MAvatar" class="list-img">
                <div :class="item.from == MId?'message sent':'message received'">{{item.content}}</div>
            </div>
        </div>
      <!-- <div class="message received">
        <div class="message-content">
          <p>Hi, how are you?</p>
          <p>Hi, how are you?</p>

          <p>Hi, how are you?</p>

          <p>Hi, how are you?</p>

          <p>Hi, how are you?</p>

        </div>
      </div>
      <div class="message sent">
        <div class="message-content">
          <p>I'm good, thanks!</p>
        </div>
      </div> -->
      <!-- 添加更多消息 -->
    </div>
    <div class="input-container">
        <div class="chat-boom">
            <el-input
                    class="textarea"
                    type="textarea"
                    :rows="7"
                    placeholder="Please input"
                    v-model="text"
            />
            <el-button type="primary" @click="call">视频通话</el-button>
            <el-button type="primary" @click="send">发送</el-button>
        </div>
    </div>
  </div>
</body>
</html>

</template>

<script>
import store from "@/store";
export default {
    name: 'Message',

    props: ['message'],

    data() {
        return {
            title:"好友聊天",
            messageList:[{content:"asdaskd1"}],
            text:'',
            MId:store.state.user.id,
            MAvatar:store.state.user.avatar
        };
    },

    mounted() {
        
    },

    methods: {
        call(){
          this.$router.push({path:'/call',query:{from:20212167,type:1}})
        },
        send(){
            
        }
    },
    created(){
        console.log();
    }
};
</script>

<style scope>
    body {
  font-family: Arial, sans-serif;
  background-color: #f2f2f2;
}

.chat-container {
  max-width: 800px;
  margin: 0 auto;
  background-color: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  padding: 10px;
}

.chat-list-left{
        padding: 20px;
        display: flex;
        flex-direction: row;
    }
    .chat-list-right{
        padding: 20px;
        display: flex;
        flex-direction: row-reverse;
    }

.chat {
  height: 600px;
  overflow-y: scroll;
  padding: 10px;
}
.chat-boom{
    width: 800px;
    display: flex;
    justify-content: space-between;
    align-items: end;
}

.message {
  margin-bottom: 10px;
}

.message-content {
  padding: 10px;
  border-radius: 5px;
}

.received {
  background-color: #e0e0e0;
  align-self: flex-start;
}

.sent {
  background-color: #dcf8c6;
  align-self: flex-end;
}

.input-container {
  display: flex;
  margin-top: 10px;
}

input[type="text"] {
  flex: 1;
  padding: 5px;
  border-radius: 5px;
  border: 1px solid #ccc;
  outline: none;
}

button {
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  margin-left: 5px;
  cursor: pointer;
}
</style>